home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
fortran
/
compiler
/
bcf
/
mathtest.f
< prev
next >
Wrap
Text File
|
1990-04-25
|
4KB
|
119 lines
program mathte
CHARACTER c
CALL r
print '(40x,"...Return")'
read '(a)',c
CALL d
END
SUBROUTINE r
logical l1,l2,l3,l4,l5,l6,l7,l8
print *,'REAL'
a=0.1
b=0.
c=-a
apb=a+b
cm1=c-1.
l1=a.gt.b
l2=b.gt.c
l3=a.gt.c
l7=c.gt.a
l4=apb.lt.c
l5=c.lt.cm1
l6=a.le.b
l8=c.lt.a
print *,' t t t t f f f f'
print *,l1,l2,l3,l8,l4,l5,l6,l7
a=0.5
b=10.
print *,a,'+',b,'=',a+b
1 ,a,'-',b,'=',a-b
1 ,a,'*',b,'=',a*b
1 ,a,'/',b,'=',a/b
print *,' abs(-1.) =',abs(-1.)
1 ,' abs(1.) =',abs(1.)
print *,' nint(-1.2) =',nint(-1.2)
1 ,' nint(1.2) =',nint(1.2)
print *,'sign(-1.,1.)=',sign(-1.,1.)
1 ,' sign(1.,-1.)=',sign(1.,-1.)
print *,' dim(-1.,1.)=',dim(-1.,1.)
1 ,' dim(1.,-1.)=',dim(1.,-1.)
b=100.
d=asin(sin(a))
print '(a,f4.2,a,g16.7)',' asin(sin(',a,'))=',d
d=acos(cos(a))
print '(a,f4.2,a,g16.7)',' acos(cos(',a,'))=',d
d=atan(tan(a))
print '(a,f4.2,a,g16.7)',' atan(tan(',a,'))=',d
d=tan(atan2(a,1.))
print '(a,f4.2,a,g16.7)','tan(atan2(',a,',1.))=',d
d=log(exp(a))
print '(a,f4.2,a,g16.7)',' log(exp(',a,'))=',d
d=log10(b)
print '(a,f4.0,a,g16.7)',' log10(',b,')=',d
d=b**2.
d=sqrt(d)
print '(a,f4.0,a,g16.7)',' sqrt(',b,'**2.)=',d
d=cosh(a)**2.-sinh(a)**2.
print '(2(a,f3.1),a,g16.7)','cosh(',a,')**2-sinh(',a,')**2=',d
d=tanh(a)
print '(a,f3.1,a,g16.7)',' tanh(',a,')=',d
end
SUBROUTINE d
logical l1,l2,l3,l4,l5,l6,l7,l8
DOUBLE PRECISION a,b,d
print *,'DOUBLE PRECISION '
a=0.1d0
b=0.d0
c=-a
apb=a+b
cm1=c-1.d0
l1=a.gt.b
l2=b.gt.c
l3=a.gt.c
l7=c.gt.a
l4=apb.lt.c
l5=c.lt.cm1
l6=a.le.b
l8=c.lt.a
print *,' t t t t f f f f'
print *,l1,l2,l3,l8,l4,l5,l6,l7
a=0.5d0
b=10d0
print *,a,'+',b,'=',a+b
1 ,a,'-',b,'=',a-b
1 ,a,'*',b,'=',a*b
1 ,a,'/',b,'=',a/b
print *,' abs(-1.d0)=',abs(-1.d0)
1 ,' abs(1.d0)=',abs(1.d0)
print *,' nint(-1.2d0) =',nint(-1.2d0)
1 ,' nint(1.2d0) =',nint(1.2d0)
print *,'sign(-1.d0,1.d0)=',sign(-1.d0,1.d0)
1 ,' sign(1.d0,-1.d0)=',sign(1.d0,-1.d0)
print *,' dim(-1.d0,1.d0)=',dim(-1.d0,1.d0)
1 ,' dim(1.d0,-1.d0)=',dim(1.d0,-1.d0)
b=100d0
d=asin(sin(a))
print '(a,f4.2,a,g25.14)',' asin(sin(',a,'))=',d
d=acos(cos(a))
print '(a,f4.2,a,g25.14)',' acos(cos(',a,'))=',d
d=atan(tan(a))
print '(a,f4.2,a,g25.14)',' atan(tan(',a,'))=',d
d=tan(atan2(a,1.D0))
print '(a,f4.2,a,g25.14)','tan(atan2(',a,',1.))=',d
d=log(exp(a))
print '(a,f4.2,a,g25.14)',' log(exp(',a,'))=',d
d=log10(b)
print '(a,f4.0,a,g25.14)',' log10(',b,')=',d
d=b**2.D0
d=sqrt(d)
print '(a,f4.0,a,g25.14)',' sqrt(',b,'**2.)=',d
d=cosh(a)**2.-sinh(a)**2.
print '(a,2(f3.1,a),g25.14)','cosh(',a,')**2-sinh(',a,')**2=',d
d=tanh(a)
print '(a,f3.1,a,g25.14)',' tanh(',a,')=',d
end